package cn.edu.fzu.delivery.session;

import java.io.Closeable;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletRequestWrapper;
import javax.servlet.http.HttpSession;

public class RedisSessionRequest extends HttpServletRequestWrapper implements Closeable {

    private final RedisSession session;

    RedisSessionRequest(HttpServletRequest request, RedisSession session) {
        super(request);
        this.session = session;
    }


    @Override
    public HttpSession getSession() {
        return session;
    }


    @Override
    public HttpSession getSession(boolean create) {
        return session;
    }


    @Override
    public void close() {
        session.commit();
    }

}
